Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Función (punto) valor [Javascript]

¿Cómo creo una función con un valor después?

p.ej

 function gotolocation(href) { href = href + "?search=stackoverflow"; window.location = href; } gotolocation.href = "https://google.com";
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Podrías usar Setter

 const gotolocation = { set href(url) { url += "?search=stackoverflow"; window.location = url; } }; gotolocation.href = "https://google.com";

pero en tal caso, gotolocation sería un objeto con una función Setter vinculada a la propiedad href , no una función en sí.


Si su pregunta era: "Cómo usar esta función"
que la respuesta es simple: su función acepta un argumento, así que pase uno:

 gotolocation("https://google.com");
about 4 years ago · Juan Pablo Isaza Report

0

Puede crear un objeto con función, como una clase en OOP;

 const location = { href: "https://facebook.com", goto: () => { let link = location.href + "?search=stackoverflow"; window.location = link; } } location.href = "https://google.com"; location.goto();
about 4 years ago · Juan Pablo Isaza Report

0

puedes pasar un valor a una función

gotolocation("https://google.com");

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!